package com.vgooo.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 正则表达式匹配工具
 * @author Administrator
 *
 */
public class MatchUtils {
	
	/**
	 * 判断该字符串是否为电话号码
	 * @param mobiles
	 * @return boolean 
	 */
	public static boolean isMobileNO(String mobiles){
		Pattern p = Pattern.compile("^((13[0-9])|(14[57])|(15[0-9])|(18[0-9]))\\d{8}$");
		Matcher m = p.matcher(mobiles);
		return m.matches();
	}
	/**
	 *  判断该字符串是否为邮箱
	 * @param email
	 * @return boolean 
	 */
	public static boolean isEmail(String email){
		String regex = "^([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][a-zA-Z]{2,3}([//.][a-zA-Z]{2})?$" ;
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(email);
		return m.matches() ;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println(isEmail("805015345788@qdsfadfq.com.cn"));
	}

}
